package processor

import (
	"game/src/common"
	"hash/fnv"
	"sync/atomic"
)

// ThreadPool  没想明白  废弃了
type ThreadPool struct {
	idBin          map[int64]uint32 // 根据唯一值，绑定线程值
	namePre        string           // 线程名字前缀
	threadPoolSize uint32
	taskQueue      []chan common.IRequest
	index          atomic.Value //轮训分配以来的参考值
}

func NewThreadPool(namePre string, size uint32) ThreadPool {
	pool := ThreadPool{
		namePre:        namePre,
		threadPoolSize: size,
	}
	return pool
}

func (p ThreadPool) getIndex() {

}

func (p ThreadPool) PutTask(request common.IRequest) {
	//p.idBin[]
}

//func aaa()  {
//	h := fnv.New32a()
//	h.Write([]byte(namePre))
//	h.Sum32()
//}

func getIndex(unique string) uint32 {
	h := fnv.New32a()
	h.Write([]byte(unique))
	return h.Sum32()
}
